<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>String</title>
        <link rel="stylesheet" type="text/css" href="../resources/reset.css"/>
        <link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/>
        <link rel="stylesheet" type="text/css" href="../resources/print.css" media="print">
        <!-- GC -->
    </head>
    <body>
            <div class="body-wrap">
        <div class="top-tools">
        	<img src="../resources/print.gif" width="16" height="16" align="absmiddle">&nbsp;<a href="String.html" target="_blank">Print Friendly</a><br/>

        </div>
        <h1>Class String</h1>
        <table cellspacing="0">
            <tr><td class="label">Package:</td><td>Global</td></tr>
            <tr><td class="label">Class:</td><td>String</td></tr>
                        <tr><td class="label">Extends:</td><td>Object</td></tr>
                                    <tr><td class="label">Defined In:</td><td><a href="Ext.jss.html">Ext.js</a></td></tr>
        </table>
        <div class="description">
            These functions are available as static methods on the JavaScript String object.        </div>
        <br />
        	<a href="#properties">Properties</a>
			&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#methods">Methods</a>
			&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#events">Events</a>
        	        <hr />
        <a name="properties"></a>
        <h2>Public Properties</h2>
        <div class="no-members">This class has no public properties.</div>        <a name="methods"></a>
        <h2>Public Methods</h2>
                <table cellspacing="0" class="member-table">
            <tr>
                <th class="sig-header" colspan="2">Method</th>
                <th class="msource-header">Defined By</th>
            </tr>
                <tr class="">
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#escape">escape</a>(&nbsp;<code>String string</code>&nbsp;) : String</td>
        <td class="msource" rowspan="2">String</td>
    </tr>
    <tr class="">
        <td class="mdesc">&lt;static&gt; Escapes the passed string for ' and \</td>
    </tr>
        <tr class=" alt" expandable>
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#format">format</a>(&nbsp;<code>String string</code>, <code>String value1</code>, <code>String value2</code>&nbsp;) : String</td>
        <td class="msource" rowspan="2">String</td>
    </tr>
    <tr class=" alt" expandable>
        <td class="mdesc">&lt;static&gt; Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the token...</td>
    </tr>
        <tr class="" expandable>
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#leftPad">leftPad</a>(&nbsp;<code>String string</code>, <code>Number size</code>, <span class="optional" title="Optional">[<code>String char</code>]</span>&nbsp;) : String</td>
        <td class="msource" rowspan="2">String</td>
    </tr>
    <tr class="" expandable>
        <td class="mdesc">&lt;static&gt; Pads the left side of a string with a specified character.  This is especially useful
for normalizing ...</td>
    </tr>
        <tr class=" alt" expandable>
        <td class="micon" rowspan="2">&nbsp;</td>
        <td class="sig"><a class="mlink" href="#toggle">toggle</a>(&nbsp;<code>String value</code>, <code>String other</code>&nbsp;) : String</td>
        <td class="msource" rowspan="2">String</td>
    </tr>
    <tr class=" alt" expandable>
        <td class="mdesc">Utility function that allows you to easily switch a string between two alternating values.  The passed value
is compa...</td>
    </tr>
            </table>
                <a name="events"></a>
        <h2>Public Events</h2>
        <div class="no-members">This class has no public events.</div>                
        
                    <h2 class="mdetail-head">Method Details</h2>
            <div class="detail-wrap">
                            <a name="escape"></a>
                <div class="mdetail">
                <h3>escape</i></h3>
                <code>public function escape(&nbsp;<code>String string</code>&nbsp;)</code>
                <div class="mdetail-desc">
                    &lt;static&gt; Escapes the passed string for ' and \
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>string</code> : String<div class="sub-desc">The string to escape</div></li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>String</code><div class="sub-desc">The escaped string</div></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by String.</div>
                </div>
                            <a name="format"></a>
                <div class="mdetail alt">
                <h3>format</i></h3>
                <code>public function format(&nbsp;<code>String string</code>, <code>String value1</code>, <code>String value2</code>&nbsp;)</code>
                <div class="mdetail-desc">
                    &lt;static&gt; Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens.  Each
token must be unique, and must increment in the format {0}, {1}, etc.  Example usage:
<pre><code>var cls = <em>'my-class'</em>, text = <em>'Some text'</em>;
<b>var</b> s = String.format(<em>'<div class="{0}">{1}</div>'</em>, cls, text);
// s now contains the string: <em>'<div class="my-class">Some text</div>'</em></code></pre>
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>string</code> : String<div class="sub-desc">The tokenized string to be formatted</div></li><li><code>value1</code> : String<div class="sub-desc">The value to replace token {0}</div></li><li><code>value2</code> : String<div class="sub-desc">Etc...</div></li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>String</code><div class="sub-desc">The formatted string</div></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by String.</div>
                </div>
                            <a name="leftPad"></a>
                <div class="mdetail">
                <h3>leftPad</i></h3>
                <code>public function leftPad(&nbsp;<code>String string</code>, <code>Number size</code>, <span class="optional" title="Optional">[<code>String char</code>]</span>&nbsp;)</code>
                <div class="mdetail-desc">
                    &lt;static&gt; Pads the left side of a string with a specified character.  This is especially useful
for normalizing number and date strings.  Example usage:
<pre><code>var s = String.leftPad(<em>'123'</em>, 5, <em>'0'</em>);
// s now contains the string: <em>'00123'</em></code></pre>
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>string</code> : String<div class="sub-desc">The original string</div></li><li><code>size</code> : Number<div class="sub-desc">The total length of the output string</div></li><li><code>char</code> : String<div class="sub-desc">(optional) The character with which to pad the original string (defaults to empty string " ")</div></li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>String</code><div class="sub-desc">The padded string</div></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by String.</div>
                </div>
                            <a name="toggle"></a>
                <div class="mdetail alt">
                <h3>toggle</i></h3>
                <code>public function toggle(&nbsp;<code>String value</code>, <code>String other</code>&nbsp;)</code>
                <div class="mdetail-desc">
                    Utility function that allows you to easily switch a string between two alternating values.  The passed value
is compared to the current string, and if they are equal, the other value that was passed in is returned.  If
they are already different, the first value passed in is returned.  Note that this method returns the new value
but does not change the current string.
<pre><code><i>// alternate sort directions</i>
sort = sort.toggle(<em>'ASC'</em>, <em>'DESC'</em>);

<i>// instead of conditional logic:</i>
sort = (sort == <em>'ASC'</em> ? <em>'DESC'</em> : <em>'ASC'</em>);</code></pre>
                <div class="mdetail-params">
                    <strong>Parameters:</strong>
                    <ul><li><code>value</code> : String<div class="sub-desc">The value to compare to the current string</div></li><li><code>other</code> : String<div class="sub-desc">The new value to use if the string already equals the first value passed in</div></li>                    </ul>
                    <strong>Returns:</strong>
                    <ul>
                        <li><code>String</code><div class="sub-desc">The new value</div></li>
                    </ul>
                </div>
                </div>
                <div class="mdetail-def">This method is defined by String.</div>
                </div>
                        </div>
        
                
        </div>
    <hr>
    <div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>

    </body>
</html>